using System;
using System.Data;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;
using DataObject.Helpers;

namespace DataObject.Model
{
    [Serializable]
    public class RouteServiceDTO : DTOBase
    {
        public RouteServiceDTO()
        {
            RouteServiceID = Helper.NewSeqGuid();
            ModifiedDate = DateTime.Now;
        }

        public string ServiceTypeName
        {
            get { return define.Services[ServiceType]; }
        }

        /// <summary>
        /// Reason "greater than 2 set 2" is remove shuttle type.
        /// </summary>
        protected void OnServiceTypeChanged()
        {
            ServiceType = ServiceType > 2 ? 2 : ServiceType;
        }

        #region Reference property Members

        private ProviderDTO _provider = new ProviderDTO();
        public ProviderDTO Provider
        {
            get
            {
                return _provider;
            }
            set
            {
                if (_provider != value)
                {
                    _provider = value;
                }
            }
        }
        private RouteDTO _route = new RouteDTO();
        public RouteDTO Route
        {
            get
            {
                return _route;
            }
            set
            {
                if (_route != value)
                {
                    _route = value;
                }
            }
        }
        private ServiceDTO _service = new ServiceDTO();
        public ServiceDTO Service
        {
            get
            {
                return _service;
            }
            set
            {
                if (_service != value)
                {
                    _service = value;
                }
            }
        }

        #endregion

        #region Collection Members


        #endregion

        #region Property DayOfRoute

        private int _dayOfRoute;

        /// <summary>
        ///  Property DayOfRoute
        /// <summary>
        public int DayOfRoute
        {
            get
            {
                return _dayOfRoute;
            }

            set
            {
                if (_dayOfRoute != value)
                {
                    this.OnDayOfRouteChanging(value);
                    _dayOfRoute = value;
                    this.OnDayOfRouteChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property HotelPickupAddress

        private string _hotelPickupAddress;

        /// <summary>
        ///  Property HotelPickupAddress
        /// <summary>
        public string HotelPickupAddress
        {
            get
            {
                return _hotelPickupAddress;
            }

            set
            {
                if (_hotelPickupAddress != value)
                {
                    this.OnHotelPickupAddressChanging(value);
                    _hotelPickupAddress = value;
                    this.OnHotelPickupAddressChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ModifiedBy

        private string _modifiedBy;

        /// <summary>
        ///  Property ModifiedBy
        /// <summary>
        public string ModifiedBy
        {
            get
            {
                return _modifiedBy;
            }

            set
            {
                if (_modifiedBy != value)
                {
                    this.OnModifiedByChanging(value);
                    _modifiedBy = value;
                    this.OnModifiedByChanged();
                }
            }
        }

        #endregion

        #region Property ModifiedDate

        private DateTime? _modifiedDate;

        /// <summary>
        ///  Property ModifiedDate
        /// <summary>
        public DateTime? ModifiedDate
        {
            get
            {
                return _modifiedDate;
            }

            set
            {
                if (_modifiedDate != value)
                {
                    this.OnModifiedDateChanging(value);
                    _modifiedDate = value;
                    this.OnModifiedDateChanged();
                }
            }
        }

        #endregion

        #region Property Program

        private string _program;

        /// <summary>
        ///  Property Program
        /// <summary>
        public string Program
        {
            get
            {
                return _program;
            }

            set
            {
                if (_program != value)
                {
                    this.OnProgramChanging(value);
                    _program = value;
                    this.OnProgramChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ProviderID

        private Guid? _providerID;

        /// <summary>
        ///  Property ProviderID
        /// <summary>
        public Guid? ProviderID
        {
            get
            {
                return _providerID;
            }

            set
            {
                if (_providerID != value)
                {
                    this.OnProviderIDChanging(value);
                    _providerID = value;
                    this.OnProviderIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property RouteID

        private Guid _routeID;

        /// <summary>
        ///  Property RouteID
        /// <summary>
        public Guid RouteID
        {
            get
            {
                return _routeID;
            }

            set
            {
                if (_routeID != value)
                {
                    this.OnRouteIDChanging(value);
                    _routeID = value;
                    this.OnRouteIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property RouteServiceID

        private Guid _routeServiceID;

        /// <summary>
        ///  Property RouteServiceID
        /// <summary>
        public Guid RouteServiceID
        {
            get
            {
                return _routeServiceID;
            }

            set
            {
                if (_routeServiceID != value)
                {
                    this.OnRouteServiceIDChanging(value);
                    _routeServiceID = value;
                    this.OnRouteServiceIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ServiceID

        private Guid? _serviceID;

        /// <summary>
        ///  Property ServiceID
        /// <summary>
        public Guid? ServiceID
        {
            get
            {
                return _serviceID;
            }

            set
            {
                if (_serviceID != value)
                {
                    this.OnServiceIDChanging(value);
                    _serviceID = value;
                    this.OnServiceIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ServiceType

        private int _serviceType;

        /// <summary>
        ///  Property ServiceType
        /// <summary>
        public int ServiceType
        {
            get
            {
                return _serviceType;
            }

            set
            {
                if (_serviceType != value)
                {
                    this.OnServiceTypeChanging(value);
                    _serviceType = value;
                    this.OnServiceTypeChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Extensibility Method Declarations

        protected virtual void OnDayOfRouteChanging(int dayOfRoute) { }
        protected virtual void OnDayOfRouteChanged() { }
        protected virtual void OnHotelPickupAddressChanging(string hotelPickupAddress) { }
        protected virtual void OnHotelPickupAddressChanged() { }
        protected virtual void OnModifiedByChanging(string modifiedBy) { }
        protected virtual void OnModifiedByChanged() { }
        protected virtual void OnModifiedDateChanging(DateTime? modifiedDate) { }
        protected virtual void OnModifiedDateChanged() { }
        protected virtual void OnProgramChanging(string program) { }
        protected virtual void OnProgramChanged() { }
        protected virtual void OnProviderIDChanging(Guid? providerID) { }
        protected virtual void OnProviderIDChanged() { }
        protected virtual void OnRouteIDChanging(Guid routeID) { }
        protected virtual void OnRouteIDChanged() { }
        protected virtual void OnRouteServiceIDChanging(Guid routeServiceID) { }
        protected virtual void OnRouteServiceIDChanged() { }
        protected virtual void OnServiceIDChanging(Guid? serviceID) { }
        protected virtual void OnServiceIDChanged() { }
        protected virtual void OnServiceTypeChanging(int serviceType) { }

        #endregion

    }
}
